<template>
    <div>
        <div class="tool-box row g-2">
            <div class="col-4">
                <bi-select v-model="search.type" :option="typeOption" placeholder="请选择类型"></bi-select>
            </div>
            <div class="col-8">
                <bi-input v-model="search.keywords" placeholder="请输入商品名称"></bi-input>
            </div>
        </div>
        <div class="apply-goods-content">

        </div>
        <bi-pagination v-model="page" :total="total" :count="count" v-if="search.type!='goods'"  ></bi-pagination>
    </div>
</template>

<script>
export default{
    dialog:{
        title:'适用商品',
        width:700,
        loading:true
    },
    data(){

        let search = {
            type:'',
            keywords:''
        }


        let typeOption = [
           
        ]

        return {
            typeOption,
            list:[],
            total:0,
            count:0,
            search
        }
    },
    props:['id'],
    methods:{
       getList(){
            this.$ajax({
                url:this.$url({'app':'shop','controller':'admin.coupon','action':'applyGoodsList'}),
                data:{
                    coupon_id:this.id,
                    type:this.search.type,
                    keywords:this.search.keywords
                },
                success:(data)=>{
                    this.list = data.list;
                }
            })
       }
    },
    mounted(){
        this.$ajax({
            url:this.$url({'app':'shop','controller':'admin.coupon','action':'applyGoodsInit'}),
            data:{
                coupon_id:this.id
            },
            success:(data)=>{
                
                this.typeOption =  data;

                this.search.type = data[0].value;

                this.dialog.loading  = false;
            }
        })
    }
}
</script>


<style>
.apply-goods-content{
    height: 300px;
    overflow-y: auto;
    padding: 10px;
}
</style>